package cn.waqwb;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ResourceBundle;

public class ExecuteDemo {
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        ResourceBundle bundle = ResourceBundle.getBundle("jdbc");
        String url = bundle.getString("url");
        String user = bundle.getString("user");
        String password = bundle.getString("password");
        Connection conn  = DriverManager.getConnection(url,user,password);
        Statement statement = conn.createStatement();
        //String sql = "insert into t_user(id,email,nickname,password) values(null,'121e@q.com','lilei','1')";
        String sql ="UPDATE  t_user SET nickname='hanmeimeil' WHERE nickname='lilei'";
        //String sql = "select * from t_user";
//        ResultSet resultSet = statement.getResultSet();
//        String str = execute?"ResultSet":"xxx";
//        System.out.println(str);
        int i = statement.executeUpdate(sql);
        String str = i>0?"更新成功":"失败";
        System.out.println(str);
    }
}
